<template>
  <div class="tagBalanceRecord">
    <c-title :hide="false" :text="'过期标签记录'"></c-title>
    <div class="background_box"></div>
    <div class="list">
      <div class="lis" v-for="item in list" :key="item.id">
        <div class="lis_l" v-if="item.tag">{{ item.tag.tag_name }}</div>
        <div class="lis_r">{{ item.deleted_at }}</div>
      </div>
    </div>
  </div>
</template>
<script>
import { scrollMixin } from "utils/mixin";
export default {
  mixins: [scrollMixin], //加载更多
  data() {
    return {
      list: [],
      page: 1,
      total_page: 0,
      isLoadMore: true
    };
  },
  activated() {
    this.getData();
  },
  methods: {
    getData() {
      $http.get("plugin.tag-balance.frontend.tag.expire-tag", { page: this.page }, "加载中..").then(response => {
        if (response.result == 1) {
          this.list = response.data.list.data;
          this.total_page = response.data.list.last_page;
        } else {
          this.$dialog.alert({
            message: response.msg
          });
        }
      });
    },
    getMoreData() {
      this.isLoadMore = false; // 防止多次请求分页数据
      if (this.page >= this.total_page) {
        return;
      } else {
        this.page = this.page + 1;
        $http.get("plugin.tag-balance.frontend.tag.expire-tag", { page: this.page }, "正在获取更多订单").then(response => {
          if (response.result == 1) {
            this.isLoadMore = true;
            var myData = response.data.list.data;
            this.list = this.list.concat(myData); // 数组拼接
          } else {
            this.page = this.page - 1;
            this.isLoadMore = false;
            return;
          }
        });
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.background_box {
  color: #382c0a;
  background-color: #fff;
  background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
  background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
  background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
  min-height: 9.25rem;
  padding: 1.5938rem 1.0938rem 0 1.0938rem;
}
.list {
  border-radius: 0.625rem;
  background: #fff;
  margin: 0 0.625rem;
  margin-top: -6rem;
  padding: 0.75rem;
  .lis {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(187, 187, 187, 0.2);
    font-size: 1rem;
    .lis_r{
      color:  rgba(0, 0, 0, 0.6);
      font-size: 0.8rem;
    }
  }
  .lis:last-child {
    margin-bottom: 0;
    border-bottom: 0px;
  }
}
</style>
